package com.apes.framework.plugin.scheduler;

import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.Model;
import com.apes.framework.jpa.Name;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;

/**
 * 功能：定时间任务实体
 *
 * @author xul
 * @create 2018-03-17 16:52
 */
@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = "scheduler_task")
public class Task extends Model {

    /**
     * 任务ID
     */
    @Id
    @Column(name = "id", length = 60)
    private String id;

    /**
     * 任务描述
     */
    @Name
    @Column(name = "description", length = 60, nullable = false)
    private String description;

    /**
     * cron表达式
     */
    @Column(name = "cron_expression", length = 60, nullable = false)
    private String cronExpression;

    @Column(name = "valid", nullable = false)
    private boolean valid = true; //有效


    /**
     * 执行的ESB方法方法
     */
    @Column(name = "method", length = 120, nullable = false)
    private String method;

    /**
     * 参数
     */
    @Column(name = "parameter", length = 120)
    private String parameter;

    /**
     * 钉钉帐号
     */
    @Column(name = "dingding_account", length = 250)
    private String dingdingAccount;
}
